<?php
$finduser=$_GET['usr'];
if(!isset($_GET['pg'])) {$_GET['pg']=1;}
$pstart= $_GET['pg']*10-10;
$pcount=10;

require_once("../../class2.php");
require_once(HEADERF);
		$user_id = USERID;
		$user_name = USERNAME;
require_once("./includes/require_all.php");

ramka("open");

echo "<div style='float:right;'><a href='../' class='forumheader4' style='font-size:14px; margin-left:10px;'>НАЗАД</a></div>";
echo "<div class='forumheader3 textWHITE'>Одобрени преводи на потребителя: <span class='textRED'>$finduser</span></div>";
if (USERNAME===$finduser OR in_array(USERNAME,$adminss,true)){
	$admin_prefs=mysql_query("SELECT game_prefix,urlprefix FROM admin_panel");
	while($tpref= mysql_fetch_array($admin_prefs)){
		if ($tpref[0]!=''){
			$tselects[]="(SELECT *,'$tpref[0]' as 'table_pref' FROM $tpref[0]_translations WHERE original IS NOT NULL AND translator_name='$finduser' AND status='Одобрен')";
			$gnames[$tpref[0]]=$tpref[1];
		}
	}
	$massquerry= implode(' UNION ', $tselects);
	$massquerry.=" ORDER BY time DESC LIMIT $pstart,$pcount";  

	$mass= mysql_query($massquerry);
	while ($s1= mysql_fetch_array($mass)){
		$s2=explode("\n",trim($s1['original']));
		foreach ($s2 as $s3) {
			$s4=explode("=>",trim($s3));
			$statecho[$s4[0]]['BG1']=$s4[1];
		}	unset($s2,$s3,$s4);
		$s2=explode("\n",trim($s1['translation']));
		foreach ($s2 as $s3) {
			$s4=explode("=>",trim($s3));
			$s4[1]=str_replace("<","&lt;",$s4[1]);
			$statecho[$s4[0]]['BG2']=$s4[1];
		}	unset($s2,$s3,$s4);
		$gname= $gnames[$s1['table_pref']];
		echo "<div class='forumheader3'><div style='float:right'><a href='viewtext.php?game=$gname&name=$s1[file_name]&page=$s1[page]&sby=1&go=pending#$s1[id]' class='forumheader3'>$gname</a></div>";
		foreach($statecho as $secho){
			if ($secho['BG2']=='') $secho['BG2']="<span class='textRED'><изтрито></span>";
			if($secho['BG1']!=$secho['BG2']){
				echo<<<HTML
				<div class='forumheader'>
					<span class='textGREEN'>$secho[BG2]</span>
					<BR>
					<span class='textYELLOW'>$secho[BG1]</span>
				</div>
HTML;
			}
			else echo<<<HTML
				<div class='forumheader'>
					<span>$secho[BG2]</span>
				</div>
HTML;
			$tI=true;
		}
		echo "</div>";
		unset ($statecho);
	}
	if(!isset($tI)){ echo "<div class='forumheader'>Не са намерени повече потвърдени преводи...</div>"; }
	$curpg=$_GET['pg']; $lpg= $curpg-1; $rpg= $curpg+1;
	echo "<center class='forumheader3'>";
	if($curpg>1) echo "<a href='utest.php?usr=$_GET[usr]&pg=".$lpg."' class='button'><</a>";
	echo " <span class='button'>$curpg</span> ";
	if(isset($tI)) echo "<a href='utest.php?usr=$_GET[usr]&pg=".$rpg."' class='button'>></a>";
	echo "</center>";
} else echo "<div class='forumheader'>Нямате право да разглеждате тази информация.</div>";
ramka("close");
?>